// 引入 Vue 和 Vuex
import Vue from 'vue'
import Vuex from 'vuex'

// 告诉 Vue 使用 Vuex
Vue.use(Vuex)

// 创建并导出 Vuex Store
export default new Vuex.Store({
  state: {
    count: 0,
	isToken:true
  },
  mutations: {
    increment(state) {
      state.count++
    },
    decrement(state) {
      state.count--
    },
	setCount(state, newCount) {
	      state.count = newCount;
	},
	setToken(state, newCount) {
		debugger
	      state.isToken = newCount;
	}
  },
  actions: {
    increment({ commit }) {
      commit('increment')
    },
    decrement({ commit }) {
      commit('decrement')
    }
  },
  getters: {
    count: state => state.count,
	isToken: state => state.isToken
  }
})